package com.training.food.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.training.food.Mapper.RetailMapper;
import com.training.food.pojo.Retail;
import com.training.food.service.RetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RetailServiceImpl extends ServiceImpl<RetailMapper, Retail> implements RetailService {
    @Autowired
    RetailMapper retailMapper;
    @Override
    public boolean select(Retail retail) {
        if(retailMapper.select(retail)!=null){
            return true;
        }
        return false;
    }

    @Override
    public int add(Retail retail) {
        int temp=retailMapper.add(retail);
        return temp;
    }

    @Override
    public void sub(Retail retail) {
        retailMapper.delete(retail);
    }

    @Override
    public void update(Retail retail) {
        retailMapper.update(retail);
    }

    @Override
    public List<Retail> selectByUser(String username, String state) {
        return retailMapper.selectByUser(username,state,"*");
    }

    @Override
    public Retail selectById(Retail retail) {
        return retailMapper.selectById(retail);
    }

    @Override
    public List<Retail> selectAll() {
        return retailMapper.selectAll();
    }

    @Override
    public List<Retail> selectAllNull(String tmp) {
        return retailMapper.selectAllNull(tmp);
    }

    @Override
    public List<Retail> retails(String message) {
        message="%"+message+"%";
        return retailMapper.retails(message);
    }
}
